import pytest
from ..Operation.Loan_Operation import Loan_Operation
from ..Data.Data import Data


class Test_login(Loan_Operation):
    da = Data()

    # 执行成功的测试用例
    @pytest.mark.parametrize('name,pwd,loanmoney,date,expect', da.readExcel('贷款'))
    def test_card_1(self, name,pwd,loanmoney,date,expect):
        sql = f"select count(loan.id) from loan join user on user.id=loan.userId where user.username='{name}'"
        expect=self.GetSuccessResult(sql)+1
        driver = self.driver()
        driver=self.login(name,pwd,driver)
        driver=self.loan(loanmoney,date,driver)
        result=self.GetSuccessResult(sql)
        self.assertResult(result, expect)